package algos

import "fmt"

// Less A比B小
func Less(a, b int) bool {
	return a < b
}

// Exch 交换位置
func Exch(a []int, i, j int) {
	var temp = a[i]
	a[i] = a[j]
	a[j] = temp
}

// Show 打印数组
func Show(a []int) {
	for _, item := range a {
		fmt.Printf("%d ", item)
	}
}

// AssertSort 校验排序
func AssertSort(a []int) bool {
	for i := 1; i < len(a); i++ {
		if Less(a[i], a[i-1]) {
			return false
		}
	}
	return true
}
